<!DOCTYPE html>
<html lang="en" dir="ltr" class="safe-area">
  <head>
    <meta charset="UTF-8" />
    <title>App - Safe Area</title>
    <meta
      name="viewport"
      content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"
    />
    <link href="../../../../../css/ionic.bundle.css" rel="stylesheet" />
    <link href="../../../../../scripts/testing/styles.css" rel="stylesheet" />
    <script src="../../../../../scripts/testing/scripts.js"></script>
    <script nomodule src="../../../../../dist/ionic/ionic.js"></script>
    <script type="module" src="../../../../../dist/ionic/ionic.esm.js"></script>
    <style>
      .safe-area {
        --ion-safe-area-top: 40px;
        --ion-safe-area-right: 40px;
        --ion-safe-area-bottom: 40px;
        --ion-safe-area-left: 40px;
      }
    </style>
  </head>

  <body>
    <ion-app>
      <ion-menu content-id="main">
        <ion-header>
          <ion-toolbar>
            <ion-title>Menu</ion-title>
          </ion-toolbar>
        </ion-header>
        <ion-content>
          <ion-list>
            <ion-item>First</ion-item>
            <ion-item>Second</ion-item>
            <ion-item>Third</ion-item>
            <ion-item>Fourth</ion-item>
            <ion-item>Fifth</ion-item>
          </ion-list>
        </ion-content>
      </ion-menu>

      <ion-header>
        <ion-toolbar color="primary">
          <ion-title>App - Safe Area</ion-title>
        </ion-toolbar>
      </ion-header>

      <ion-content id="main">
        <ion-card>
          <ion-card-header>
            <ion-card-title>Card</ion-card-title>
          </ion-card-header>
          <ion-card-content>
            <button class="expand" id="show-action-sheet" onclick="showActionSheet()">Show Action Sheet</button>
            <button class="expand" id="show-menu" onclick="showMenu()">Show Menu</button>
            <button class="expand" id="show-picker" onclick="showPicker()">Show Picker</button>
            <button class="expand" id="show-toast" onclick="showToast()">Show Toast</button>
          </ion-card-content>
        </ion-card>

        <ion-list>
          <ion-list-header>
            <ion-label>List Header</ion-label>
          </ion-list-header>
          <ion-item>
            <ion-label>Item</ion-label>
          </ion-item>
          <ion-item-divider>
            <ion-label>Item Divider</ion-label>
          </ion-item-divider>
          <ion-item-sliding>
            <ion-item>
              <ion-label>Item Sliding</ion-label>
            </ion-item>
            <ion-item-options side="start">
              <ion-item-option>Start</ion-item-option>
            </ion-item-options>
            <ion-item-options side="end">
              <ion-item-option>End</ion-item-option>
            </ion-item-options>
          </ion-item-sliding>
        </ion-list>

        <ion-fab vertical="bottom" horizontal="end">
          <ion-fab-button color="danger">
            <ion-icon name="add"></ion-icon>
          </ion-fab-button>
        </ion-fab>
      </ion-content>

      <ion-footer>
        <ion-toolbar>
          <ion-title>Footer</ion-title>
        </ion-toolbar>
      </ion-footer>

      <ion-picker-controller></ion-picker-controller>
      <ion-toast-controller></ion-toast-controller>
    </ion-app>

    <script>
      async function showActionSheet() {
        const actionSheet = Object.assign(document.createElement('ion-action-sheet'), {
          header: 'Action Sheet',
          buttons: ['First', 'Second', 'Third'],
        });
        document.body.appendChild(actionSheet);
        await actionSheet.present();
      }

      async function showMenu() {
        const menu = document.querySelector('ion-menu');
        await menu.open();
      }

      async function showPicker() {
        const picker = Object.assign(document.createElement('ion-picker-legacy'), {
          columns: [
            {
              name: 'Picker',
              selectedIndex: 2,
              options: [
                { text: 'First' },
                { text: 'Second' },
                { text: 'Third' },
                { text: 'Fourth' },
                { text: 'Fifth' },
              ],
            },
          ],
        });
        document.body.appendChild(picker);
        await picker.present();
      }

      async function showToast() {
        const toast = Object.assign(document.createElement('ion-toast'), {
          message: 'Hello world!',
          buttons: [{ text: 'Close', role: 'cancel' }],
        });
        document.body.appendChild(toast);
        await toast.present();
      }
    </script>
  </body>
</html>
